package org.hard.model.create.prototype;

import cn.hutool.core.date.DateTime;
import cn.hutool.core.date.DateUtil;
import cn.hutool.json.JSON;
import cn.hutool.json.JSONUtil;

import java.util.ArrayList;
import java.util.List;

/**
 * @author: 王林博
 * @date: 2023年02月11日 10:06
 */
public class Application {

    List<Shape> shapes = new ArrayList<>();

    Application() {

        Circle circle = new Circle();
        circle.x = 10;
        circle.y = 20;
        circle.radius = 30;
        shapes.add(circle);

        System.out.println(shapes.get(0).x);

        Circle anotherCircle = (Circle) circle.clone();
        shapes.add(anotherCircle);


        Rectangle rectangle = new Rectangle();
        rectangle.width = 10;
        rectangle.height = 20;
        shapes.add(rectangle);
        System.out.println(shapes.get(1).x);
    }


    public static void main(String[] args) {
//        Integer startTime = Math.toIntExact(DateUtil.offsetMonth(new DateTime(), -2).getTime() / 1000);
//        System.out.println(startTime);
        List<Shape> shapeList = new ArrayList<>();

        Application application = new Application();
        System.out.println(application.shapes.get(0).x);

        shapeList.addAll(application.shapes);
        System.out.println(shapeList.get(0).x);

    }
}
